From: Sundeep Mediratta Date: Wed, 9 Oct 2024 17:17:30 +0000 (-0400) Subject: slider: Consider text direction when handling arrow keys X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~194^2^2~15 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=50fa7ef18311be504fcc72ec502206847ba3c750;p=gnome-shell.git slider: Consider text direction when handling arrow keys Currently the right arrow key always increases the slider value, even in RTL locales where the slider itself increases leftwards. Fix that, so that the arrow keys always correspond to the direction of the slider. Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7963 Part-of: (cherry picked from commit 5309f747fad23ebc707870868016f0414776e59c) --- diff --git a/js/ui/slider.js b/js/ui/slider.js index fc4a2579b..06a6843ba 100644 --- a/js/ui/slider.js +++ b/js/ui/slider.js @@ -193,7 +193,9 @@ export const Slider = GObject.registerClass({ vfunc_key_press_event(event) { let key = event.get_key_symbol(); if (key === Clutter.KEY_Right || key === Clutter.KEY_Left) { - let delta = key === Clutter.KEY_Right ? 0.1 : -0.1; + const rtl = this.get_text_direction() === Clutter.TextDirection.RTL; + const increaseKey = rtl ? Clutter.KEY_Left : Clutter.KEY_Right; + const delta = key === increaseKey ? 0.1 : -0.1; this.value = Math.max(0, Math.min(this._value + delta, this._maxValue)); return Clutter.EVENT_STOP; }